package com.xiaotu.spider.douban.pipeline;

import org.springframework.stereotype.Component;

import com.xiaotu.common.model.TVDouBanModel;
import com.xiaotu.common.util.Constants;
import com.xiaotu.common.util.DataRedisKeyUtils;
import com.xiaotu.spider.APipeline;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
@Component("DouBanReviesPipeline")
public class DouBanReviesPipeline extends APipeline{

	@Override
	protected void doProcess(ResultItems resultItems, Task task) {
		TVDouBanModel tv_douban = resultItems.get(TVDouBanModel.class.getName());
        if (tv_douban == null)
            return;
        String key = DataRedisKeyUtils.getKey(Constants.DataRedisKey.TV_DOUBAN_YYYYMMDD);
    	cacheHandler.hSet(key, tv_douban.getTvId(), tv_douban);
        cacheHandler.setCacheTimeout(key);
	}
	
}
